﻿using System;
using System.Collections.Generic;
using System.Text;
using Lswweb.Domain;
using Lswweb.Model;
using Lswweb.Common;

namespace Lswweb.Controls
{
    public class StatusHandler : ModelHandler
    {
        protected override void Handler(int id,SiteModule type)
        {
            switch (type)
            {
                case  SiteModule.Order:
                    Orders.UpdateStatus(Convert.ToInt32(id), (OrderStatus)Status);
                    break;
                case SiteModule.Product:
                    Products.UpdateState(id.As<int>(), (StatusType)Status);
                    break;
                default :
                    SiteContext.RenderMessage(ExceptionType.PageNotFond, SiteContext.Current.ReferrerUrl);
                    break;
            }
        }

        private int Status
        {
            get
            {
                return SiteContext.Current.Status;
            }
        }
    }
}
